package com.matou.commons.exception;


/**
 * @Author CM
 * @Date 2021/6/3 15:14
 * @Description EcError
 * @Version 1.0
 */
public enum MtError implements IError {

    /** 码头全局消息返回配置  **/
    MT_000000("000000","操作成功！","操作成功！","码头-公共模块"),

    /** MT000 网关模块  **/
    MT_000001("MT000001","该URI不允许外部访问！","该URI不允许外部访问！","码头-网关模块"),
    MT_000002("MT000002","不支持该认证类型！","不支持该认证类型！","码头-网关模块"),
    MT_000003("MT000003","请求类型错误,请切换POST请求！","请求类型错误,请切换POST请求！","码头-网关模块"),
    MT_000004("MT000004","refresh token无效！","refresh token无效！","码头-网关模块"),
    MT_000005("MT000005","用户已被锁定，请联系管理员！","用户已被锁定，请联系管理员！","码头-网关模块"),
    MT_000006("MT000006","用户名或密码错误！","用户名或密码错误！","码头-网关模块"),
    MT_000007("MT000007","认证失败！","认证失败！","码头-网关模块"),
    MT_000008("MT000008","","","码头-网关模块"),
    MT_000009("MT000009","请通过网关获取资源!","请通过网关获取资源!","码头-网关模块"),


    /** MT999模块 此类异常不允许再开发是使用  **/
    MT_999995("MT999995","未知异常！","未知异常！","码头-公共模块"),
    MT_999996("MT999996","参数json转化对象失败！","抱歉，参数错误！","码头-公共模块"),
    /** 此异常为参数校验解析后的异常  **/
    MT_999997("MT999997","参数异常！","参数异常！","码头-公共模块"),
    MT_999998("MT999998","参数异常！","参数异常！","码头-公共模块"),
    MT_999999("MT999999","全局未知异常！","初始化药品厂商简拼异常！","码头-公共模块"),



    /** MT001模块 用户权限类异常在此添加  **/
    MT_001001("MT001000","用户权限类未知异常！","未知异常！","码头-用户模块"),
    MT_001002("MT001001","token无效！","token无效！","码头-用户模块"),
    MT_001003("MT001002","没有权限访问该资源！","没有权限访问该资源！","码头-用户模块"),
    MT_001004("MT001003","参数异常！","参数异常！","码头-用户模块"),
    MT_001005("MT001004","全局未知异常！","初始化药品厂商简拼异常！","码头-用户模块"),



    ;
    /** 错误码code */
    private String code;
    /** 真实原因 */
    private String realMsg;
    /** 终端显示原因 */
    private String termMsg;
    /** 来源  业管系统  统一登录  公共接口服务 */
    private String source;

    MtError(String code, String realMsg, String termMsg, String source) {
        this.code = code;
        this.realMsg = realMsg;
        this.termMsg = termMsg;
        this.source = source;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getErrorMsg() {
        // 终端显示异常信息
        return "("+code+")"+termMsg;
    }

    @Override
    public String getRealMsg() {
        return "("+code+")"+realMsg;
    }

    @Override
    public String toString() {
        return "EcError{" +
                "code=" + code +
                ", realMsg=" + realMsg +
                ", termMsg=" + termMsg +
                ", source=" + source +
                '}';
    }

    public String getTermMsg() {
        return termMsg;
    }

    public String getSource() {
        return source;
    }

    public String getSelfRealMsg() {
        return realMsg;
    }

}
